<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\modules\home\models\Category */
/* @var $form yii\widgets\ActiveForm */

$cate = [
    [
        'id' => 0,
        'title' => '无上级目录',
        'spac' => ''
    ],
];
$cate = array_merge($cate,$catelist);
$newcate = [];
foreach($cate as $v){
    $newcate[$v['id']] = $v['spac'] . $v['title'];
}

?>

<div class="category-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'cid')->dropDownList($newcate,['value'=>$model->cid]) ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sort')->textInput()->label('排序 <span style="color:red">【 数值越大越靠前 】</span>') ?>

    <?= $form->field($model, 'is_top_show')->dropDownList(['1' => '显示', '0' => '不显示']) ?>

    <?= $form->field($model, 'is_footer_show')->dropDownList(['1' => '显示', '0' => '不显示']) ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
